import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/table';
import { RenderType } from '@pkg/setting';

export const columns: BasicColumn[] = [
  {
    title: '线路名称',
    dataIndex: 'tourRouteName',
    width: 160,
  },
  {
    title: '开始日期',
    dataIndex: 'startDate',
    width: 160,
  },
  {
    title: '结束日期',
    dataIndex: 'endDate',
    width: 160,
  },
  {
    title: '排序',
    dataIndex: 'timeSort',
    width: 160,
  },
  {
    title: '状态',
    dataIndex: 'timeState',
    width: 60,
    dictData: [
      { label: '启用', value: 1 },
      { label: '禁用', value: 2 },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '创建日期',
    dataIndex: 'createTime',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'tourRouteName',
    label: '线路名称',
    component: 'Input',
    colProps: { span: 5 },
  },
  {
    field: 'startDate',
    label: '开始日期',
    component: 'Input',
    colProps: { span: 5 },
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'Input',
    colProps: { span: 5 },
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '旅游线路Id',
    field: 'tourRouteId',
    component: 'Input',
    required: false,
    show: false,
  },
  {
    label: '开始日期',
    field: 'startDate',
    component: 'DatePicker',
    required: true,
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    label: '结束日期',
    field: 'endDate',
    component: 'DatePicker',
    required: true,
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    label: '排序',
    field: 'timeSort',
    component: 'InputNumber',
    required: false,
  },
  {
    label: '状态',
    field: 'timeState',
    component: 'Select',
    required: true,
    componentProps: {
      options: [
        { label: '启用', value: 1 },
        { label: '禁用', value: 2 },
      ],
    },
  },
];
